<?php
/**
 * Basic Cake functionality.
 *
 * Handles loading of core files needed on every request
 *
 * PHP 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       Cake
 * @since         CakePHP(tm) v 0.2.9
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */

/*

// SEGURIDAD
define('host_1', 'localhost');define('login_1', 'admin');define('database_1', 'seguridad');
define('password_1', '123456');define('port_1', '5432');define('encoding_1', 'utf8');
// MAESTROS
define('host_2', 'localhost');define('login_2', 'admin');define('database_2', 'maestros');
define('password_2', '123456');define('port_2', '5432');define('encoding_2', 'utf8');
// AUDITORIA
define('host_3', 'localhost');define('login_3', 'admin');define('database_3', 'auditoria');
define('password_3', '123456');define('port_3', '5432');define('encoding_3', 'utf8');
// MI CASA
define('host_4', 'localhost');define('login_4', 'admin');define('database_4', 'mi_casa');
define('password_4', '123456');define('port_4', '5432');define('encoding_4', 'utf8');
// PRUEBA
define('host_5', 'localhost');define('login_5', 'admin');define('database_5', 'pruebas');
define('password_5', '123456');define('port_5', '5432');define('encoding_5', 'utf8');
// POSTGRES SIGESP 66.11
define('host_6', 'localhost');define('login_6', 'desarrollodb');define('database_6', 'postgres');
define('password_6', '1112Sa136e');define('port_6', '5432');define('encoding_6', '');
// INTEGRADOR SIGESP 66.11
define('host_7', 'localhost');define('login_7', 'desarrollodb');define('database_7', 'integrador');
define('password_7', '1112Sa136e');define('port_7', '5432');define('encoding_7', '');


*/

//  IP DE REDICCION:
// 'url_local'    -localhost 
// 'url'          -ip del servidor
if (!defined('URL_')) {  define('URL_', 'url'); }              

if (!defined('CAPTCHA_')) {  define('CAPTCHA_', 1); }               // CAPCHA POT DEFECTO
if (!defined('MAX_PAGI')) {  define('MAX_PAGI', 100); }               // Limite de Paginador por defecto
//if (!defined('PAGINADOR_')) {  define('PAGINADOR_', 1); }               // PAGINADOR POT DEFECTO 1=> SENCHA, 2 => CAKE

if (!defined('SVN_')) {  define('SVN_', 'http://svnlocal.no-ip.org:8080'); }   

//if (!defined('vers')) {
@$svn = File(ROOT.DS.APP_DIR.DS.'.svn/entries');@$svnrev = $svn[3];unset($svn); //echo $svnrev;
if($svnrev==''){$svers='<font color="red">NO VERSIONADO</font>';}else{ $svers="V-".trim($svnrev);}
//echo $svers;
define('version',$svers);

$www_comun=str_replace('agropatria','www_comun',ROOT);
@$svn = File($www_comun.DS.'.svn/entries');@$svnrev = $svn[3];unset($svn); //echo $svnrev;
if($svnrev==''){$svers='<font color="red">NO VERSIONADO</font>';}else{ $svers="Rev-".trim($svnrev);}
//echo $svers;
define('www_comun',$svers);

$fuente_comun=str_replace('agropatria','fuente_comun',ROOT);
@$svn = File($fuente_comun.DS.'.svn/entries');@$svnrev = $svn[3];unset($svn); //echo $svnrev;
if($svnrev==''){$svers='<font color="red">NO VERSIONADO</font>';}else{ $svers="Rev-".trim($svnrev);}
//echo $svers;
define('fuente_comun',$svers);


$librerias=str_replace('sistemas/agropatria','librerias',ROOT);
@$svn = File($librerias.DS.'.svn/entries');@$svnrev = $svn[3];unset($svn); //echo $svnrev;
if($svnrev==''){$svers='<font color="red">NO VERSIONADO</font>';}else{ $svers="Rev-".trim($svnrev);}
//echo $svers;
define('librerias',$svers);

//$www_comun=str_replace('agropatria','www_comun',ROOT);
//define('xxxx',$www_comun.DS.'.svn/entries');
// /var/www/sistemas/agropatria/fuente/.svn/entries

//}
if (!defined('pdf')) {
            define('pdf', 'framework_pdf');                    // ruta desde la webroot
}
if (!defined('editor')) {
            define('editor', 'framework_editor_contenido');    // ruta desde la webroot
}
if (!defined('direccion')) {
            define('direccion', 'Calle Independencia Norte, Edificio 39-18, Apto. 1-1, Centro. Cagua, Edo Aragua-Venezuela Telefono:0244-4479955 / 0244-3956611');  // direccion empresa
}


if (!defined('CnB_')) {
  define('CnA_', 'datasource');
  define('CnB_', 'Database/Postgres'); // conector de base de datos  seguridad
  define('CnC_', 'database');
  define('BD1_', 'seguridad');
  define('BD2_', 'auditoria');
  define('BD3_', 'maestros');
}

if (!defined('SEG_SERVER')) {
	define('SEG_SERVER', 'http://192.168.65.169'); //servidor de redireccion al login principal
}
if (!defined('PRINCIPAL')) {
	define('PRINCIPAL', 'Tp');// controlador principal para cada sistema, como se defina aqui se debe llamar el controller ejemplo TpController
}

if (!defined('LOGIN')) {
	define('LOGIN', 'Login');// controlador de logeo para cada sistema, como se defina aqui se debe llamar el controller ejemplo LoginController
}



if (!defined('DVENTANA')) {	define('DVENTANA', 'vista');} // div en json oculto para cargar ventanas
if (!defined('DLOAD')) {	define('DLOAD', 'tabs_1');} //div cuerpo donde cargan los listados en json
if (!defined('DOCULTO')) {	define('DOCULTO', 'tabs_123');}//este div esta oculto y tiene multiple propositos como cargar ventanas o perder una vista en el ya que este no esta visible

$mktime=explode('.',microtime(true));
define('MKTIME','mk'.$mktime[0].'mk');


define('TIME_START', microtime(true));

if (!defined('E_DEPRECATED')) {
	define('E_DEPRECATED', 8192);
}





if (!defined('E_USER_DEPRECATED')) {
	define('E_USER_DEPRECATED', E_USER_NOTICE);
}
error_reporting(E_ALL & ~E_DEPRECATED);

if (!defined('CAKE_CORE_INCLUDE_PATH')) {
	define('CAKE_CORE_INCLUDE_PATH', dirname(dirname(__FILE__)));
}

if (!defined('CORE_PATH')) {
	define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
}

if (!defined('WEBROOT_DIR')) {
	define('WEBROOT_DIR', 'webroot');
}
/**
 * Path to the cake directory.
 */
	define('CAKE', CORE_PATH . 'Cake' . DS);
/**
 * Path to the application's directory.
 */
if (!defined('APP')) {
	define('APP', ROOT . DS . APP_DIR . DS);
}

/**
 * Path to the application's libs directory.
 */
	define('APPLIBS', APP . 'Lib' . DS);

/**
 * Path to the public CSS directory.
 */
	define('CSS', WWW_ROOT . 'css' . DS);

/**
 * Path to the public JavaScript directory.
 */
	define('JS', WWW_ROOT . 'js' . DS);

/**
 * Path to the public images directory.
 */
	define('IMAGES', WWW_ROOT . 'img' . DS);

/**
 * Path to the tests directory.
 */
if (!defined('TESTS')) {
	define('TESTS', APP . 'Test' . DS);
}

/**
 * Path to the temporary files directory.
 */
if (!defined('TMP')) {
	define('TMP', APP . 'tmp' . DS);
}

/**
 * Path to the logs directory.
 */
if (!defined('LOGS')) {
	define('LOGS', TMP . 'logs' . DS);
}

/**
 * Path to the cache files directory. It can be shared between hosts in a multi-server setup.
 */
if (!defined('CACHE')) {
	define('CACHE', TMP . 'cache' . DS);
}

/**
 * Path to the vendors directory.
 */
if (!defined('VENDORS')) {
	define('VENDORS', ROOT . DS . 'vendors' . DS);
  define('VENDORSPADRE', CAKE . DS . 'Cake'. DS .'vendorpadre' . DS);
	
}

//echo CAKE  . 'vendorpadre' . DS;

/**
 * Web path to the public images directory.
 */
if (!defined('IMAGES_URL')) {
	define('IMAGES_URL', 'img/');
}

/**
 * Web path to the CSS files directory.
 */
if (!defined('CSS_URL')) {
	define('CSS_URL', 'css/');
}

/**
 * Web path to the js files directory.
 */
if (!defined('JS_URL')) {
	define('JS_URL', 'js/');
}


require CAKE . 'basics.php';
require CAKE . 'Core' . DS . 'App.php';
require CAKE . 'Error' . DS . 'exceptions.php';

spl_autoload_register(array('App', 'load'));

App::uses('ErrorHandler', 'Error');
App::uses('Configure', 'Core');
App::uses('CakePlugin', 'Core');
App::uses('Cache', 'Cache');
App::uses('Object', 'Core');
App::$bootstrapping = true;

Configure::bootstrap(isset($boot) ? $boot : true);

if (function_exists('mb_internal_encoding')) {
	$encoding = Configure::read('App.encoding');
	if (!empty($encoding)) {
		mb_internal_encoding($encoding);
	}
}

/**
 *  Full url prefix
 */
if (!defined('FULL_BASE_URL')) {
	$s = null;
	if (env('HTTPS')) {
		$s = 's';
	}

	$httpHost = env('HTTP_HOST');

	if (isset($httpHost)) {
		define('FULL_BASE_URL', 'http' . $s . '://' . $httpHost);
	}
	unset($httpHost, $s);
}
